package icu.lookyousmileface.nio.basic

import java.io.RandomAccessFile

/**
 * @title: NioCopyImage
 * @projectName NettyPro
 * @author shenj
 * @date 2020/12/1 13:03
 */
fun main(args: Array<String>):Unit {

    val  imagePath = "src/main/resources/filedata/sky.jpg";
    val  copyImageToPath = "src/main/resources/filedata/sky_copy.jpg"

    val accessFile = RandomAccessFile(imagePath, "rw")
    val accessFile_copy = RandomAccessFile(copyImageToPath, "rw")

    val accessFile_channle = accessFile.channel
    var accesssFile_copy_channel = accessFile_copy.channel

    accesssFile_copy_channel.transferFrom(accessFile_channle,0,accessFile_channle.size())
}